﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using IiiToolkitMain.Common;

namespace IiiToolkitMain.Controls
{
    public partial class VideoPtz : UserControl
    {
        private ToolTip tip;
        public VideoPtz()
        {
            InitializeComponent();
            tip = new ToolTip();
            tip.SetToolTip(this.btnUp,"上");
            tip.SetToolTip(this.btnRight,"右");
            tip.SetToolTip(this.btnDown,"下");
            tip.SetToolTip(this.btnLeft, "左");
            tip.SetToolTip(this.btnMirror, "翻转");
        }

        public event VideoPtzClick onVideoPtzClick;


        private void btnRight_MouseDown(object sender, MouseEventArgs e)
        {
            if (onVideoPtzClick != null)
            {
                onVideoPtzClick(this, new VideoPtzEventArgs(HkSDK.PTZCommand.RIGHT,  HkSDK.PTZAction.START));
            }
        }

        private void btnRight_MouseUp(object sender, MouseEventArgs e)
        {
            if (onVideoPtzClick != null)
            {
                onVideoPtzClick(this, new VideoPtzEventArgs(HkSDK.PTZCommand.RIGHT, HkSDK.PTZAction.STOP));
            }
        }

        private void btnUp_MouseDown(object sender, MouseEventArgs e)
        {
            if (onVideoPtzClick != null)
            {
                onVideoPtzClick(this, new VideoPtzEventArgs(HkSDK.PTZCommand.UP, HkSDK.PTZAction.START));
            }
        }

        private void btnUp_MouseUp(object sender, MouseEventArgs e)
        {
            if (onVideoPtzClick != null)
            {
                onVideoPtzClick(this, new VideoPtzEventArgs(HkSDK.PTZCommand.UP, HkSDK.PTZAction.STOP));
            }
        }
        private void btnDown_MouseDown(object sender, MouseEventArgs e)
        {
            if (onVideoPtzClick != null)
            {
                onVideoPtzClick(this, new VideoPtzEventArgs(HkSDK.PTZCommand.DOWN, HkSDK.PTZAction.START));
            }
        }
        private void btnDown_MouseUp(object sender, MouseEventArgs e)
        {
            if (onVideoPtzClick != null)
            {
                onVideoPtzClick(this, new VideoPtzEventArgs(HkSDK.PTZCommand.DOWN, HkSDK.PTZAction.STOP));
            }
        }

      

        private void btnLeft_MouseDown(object sender, MouseEventArgs e)
        {
            if (onVideoPtzClick != null)
            {
                onVideoPtzClick(this, new VideoPtzEventArgs(HkSDK.PTZCommand.LEFT, HkSDK.PTZAction.START));
            }
        }
        private void btnLeft_MouseUp(object sender, MouseEventArgs e)
        {
            if (onVideoPtzClick != null)
            {
                onVideoPtzClick(this, new VideoPtzEventArgs(HkSDK.PTZCommand.LEFT, HkSDK.PTZAction.STOP));
            }
        }


        private void btnMirror_MouseDown(object sender, MouseEventArgs e)
        {
            if (onVideoPtzClick != null)
            {
                //onVideoPtzClick(this, new VideoPtzEventArgs(HkSDK.PTZCommand.Mirror, HkSDK.PTZAction.START));
            }
        }
        
        private void btnMirror_MouseUp(object sender, MouseEventArgs e)
        {
            if (onVideoPtzClick != null)
            {
                //onVideoPtzClick(this, new VideoPtzEventArgs(HkSDK.PTZCommand., HkSDK.PTZAction.STOP));
            }
        }
    }
}
